package com.hotai.controller;

import com.hotai.comment.dtos.ResponseResult;
import com.hotai.comment.pojo.CourseCourseware;
import com.hotai.comment.pojo.CoursewareEquipment;
import com.hotai.service.CourseService;
import com.hotai.vo.course.CourseDetail;
import com.hotai.vo.course.CoursePage;
import com.hotai.vo.courseware.CoursewareList;
import com.hotai.vo.courseware.CoursewaredetaileList;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;

@RestController
@RequestMapping("/course")
@CrossOrigin
public class CourseController {
    @Autowired
    private CourseService courseService;
    @RequestMapping("/list")
    private ResponseResult CoursewareLit(CoursePage query){
        return    courseService.PageList(query);
    }

    @RequestMapping("/delete")
    private ResponseResult CourseDelete(@RequestBody  ArrayList<Integer> id){
        return    courseService.deleteCourse(id);
    }


    @RequestMapping("/detail")
    private ResponseResult  Coursewaredetail( CourseDetail queryware){
        return    courseService.Coursdetail(queryware);
    }

    @RequestMapping("/deleteWare")
    private ResponseResult deletCourse(@Param("cid") Integer cid,@Param("wid") Integer wid ){
        return    courseService.deleteWare(cid,wid);
    }



    @RequestMapping("/AddWare")
    private ResponseResult AddWare(@RequestBody CourseCourseware courseCourseware){
        return    courseService.AddWareCour(courseCourseware);
    }



//安装课程回显
    @RequestMapping("/detailTea")
    private ResponseResult  CoursewaredetailTea(@RequestBody CourseDetail queryware){
        return    courseService.CoursdetailTear(queryware);
    }

    //教师端课件首页
    @RequestMapping("/listWare")
    private ResponseResult wareLit( CoursePage query){
        return    courseService.WarePageList(query);
    }

//设备查看
    @RequestMapping("/listEqu")
    private ResponseResult EquLit( CoursePage query){
        return    courseService.EquPageList(query);
    }
    //添加设备
    @RequestMapping("/AddEqu")
    private ResponseResult EquLitAdd(@RequestBody CoursewareEquipment coursewareEquipment){
        return    courseService.AddEquiment(coursewareEquipment);
    }
//删除设备
    @RequestMapping("/deleteEqu")
    private ResponseResult  deleteEqu(@Param("cid") Integer cid, @Param("eid") Integer  eid){
        return    courseService.deleteEquipment(cid,eid);
    }


}
